<?php


namespace app\api\controller\v1;

use think\Response;

abstract class Base
{
    protected $pageNum;
    protected $pageSize;

    public function __construct()
    {
        $this->pageNum = Request()->param('page_num');
        $this->pageSize = Request()->param('page_size');
    }

    protected function out($data,$msg = '',$code = '',$type = 'json')
    {
        //返回结果
        $result = [
            'meta' => [
                //状态码
                'statue' => $code,
                //返回信息
                'msg' => $msg
            ],
            //数据
            'data' => $data
        ];

        return Response::create($result,$type);
    }

    public function __call($name, $arguments)
    {
        // 404,方法不存在的错误
        return $this->out([],'资源不存在',404);
    }
}